/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */
public class Main {
    public static void main(String[] args) {
    }
}
class Solution {
    public List<List<Integer>> generate(int numRows) {
        List<Integer> list = new ArrayList<>();
        List<List<Integer>> ret = new ArrayList<>(numRows);
        list.add(1);
        ret.add(list);
        for(int i=1;i<numRows;i++) {
            List<Integer> ce = new ArrayList<>();
            ce.add(1);
            List<Integer> pre = ret.get(i-1);
            for(int j = 1;j < i;j++) {
                int x = pre.get(j) + pre.get(j-1);
                ce.add(x);
            }
            ce.add(1);
            ret.add(ce);
        }
        return ret;

    }
}